const Http = require('./http').Http

export class Api {

    CATEGORIES = [
        {
            CATEGORY: 'Drug Store',
            HOST: `http://192.168.1.7:3000`,
            INTERFACES: {
                search: { desc: '', method: 'post', url: '/store/search' },
            }
        },
    ]

    constructor() {

        for (let category of this.CATEGORIES) {

            for (let name in category.INTERFACES) {

                let url = `${category.HOST}${category.INTERFACES[name].url}`
                let method = category.INTERFACES[name].method

                this[name] = data => Http[method](url, data)
            }
        }
    }
}